// The payment page
// ================

define(['zepto', 'utils', 'sui'], function($, utils) {
  return {

    init: function(data) {
      this.redirect(data.orderId);
    },
    
    /**
     * Bind handler on clicking ali payment button
     */
    redirect: function(orderId) {
      var timer = 5;
      setInterval(function(){
        timer--;
        $("p.timer").html(timer + "秒后自动跳转到结果页....");
        if(timer===0) {
          window.location.href = window.__CTX__.root + "/orders/" + orderId + "/complete";
        }
      }, 1000)
    }
  }
})